/*
 * @Author: CNN 969682281@qq.com
 * @Date: 2024-02-26 16:49:36
 * @LastEditors: CNN 969682281@qq.com
 * @LastEditTime: 2024-02-26 17:17:08
 * @FilePath: \浙江高信\zdgy\yjszsy\src\components\rebarThicknessManage\rebarDetectionEquipment\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import publicForm from "@/components/public/el-form.vue"; //弹框form
import formJs from "./regexDetail.js"; //新增弹框配置项
import FormLyout from '@/components/commonPublic/fromLayout.vue'
import actions from "@/actions";
import {
    getMangEquipmentByFid, //详情
} from "@/api/request.js";
export default {

    data() {
        return {
            primaryInfo: null,
            loading: false,
            // isLock: false,
            formData: {
                fId: null, //主键id
                fProjectid: null, //建设项目id
                fProjectname: null, //建设项目简称
                fCompanyid: null, //施工标段id
                fCompanyname: null, //施工标段简称
                fUseplace: "", //外检设备类型
                fEqptno: null, //设备编号
                fEqptname: null, //设备名称
                fEqptspecs: null, //规格型号
                fFactoryname: null, //制造厂家
                fCertificationno: null, //生产编号
                fOutdates: null, //生产日期
                fOperuserid: null, //保管人id
                fOperusername: null, //保管人
                fSourcefile: "", //资料附件
                fNote: null, //备注
                userId: null, //当前登录用户id
                userName: null, //当前登录用户姓名
                recordfiles: [], //删除文件id集合--修改时传
            },
            formObj: formJs.formObj,
            formDatafileList: [], //资料
            selected: [],
        };
    },
    components: {
        publicForm,
        FormLyout
    },
    watch: {
    },
    destroyed() {
        window.sessionStorage.removeItem("GxEmbedded-rebarThicknessManage_rebarDetectionEquipment");
    },
    mounted() {
        this.primaryInfo = JSON.parse(sessionStorage.getItem("GxEmbedded-rebarThicknessManage_rebarDetectionEquipment"))
        this.statusNum = this.primaryInfo.status;
        actions.onGlobalStateChange((state, prev) => {
            var data = prev.currentUser.projects;
            this.userInfo = prev.currentUser
        }, true);

        this.formObj.map((item) => {
            item.disabled = false;
        });
        this.formObj[10].uploadSelect = true;
        if (this.statusNum == 7) { //查看
            this.getDetail({
                fId: this.primaryInfo.data.fId
            })
            this.formObj.map((item) => {
                item.disabled = true;
            });
            this.formObj[10].uploadSelect = false;
        }
    },
    methods: {
        // 详情
        getDetail(obj) {
            this.loading = true;
            getMangEquipmentByFid(obj).then((res) => {
                if (res.errcode == 0) {
                    this.loading = false;
                    this.formDatafileList = res.data.fSourcefileList;
                    this.formData = res.data.lrMangEquipment;
                } else {
                    this.loading = false;
                    this.$message.error(res.msg);
                }
            });
        },


    },
};